package cz.acies.genea.ui.svg;

/**
 * arrow-end			string		arrowhead on the end of the path. The format for string is <type>[-<width>[-<length>]]. Possible types: classic, block, open, oval, diamond, none, width: wide, narrow, midium, length: long, short, midium.
 * clip-rect			string		comma or space separated values: x, y, width and height
 * cursor				string		CSS type of the cursor
 * cx					number		the x-axis coordinate of the center of the circle, or ellipse
 * cy					number		the y-axis coordinate of the center of the circle, or ellipse
 * fill					string		colour, gradient or image
 * fill-opacity			number
 * font					string
 * font-family			string
 * font-size			number
 * font size 						in pixels
 * font-weight			string
 * height				number
 * href					string		URL, if specified element behaves as hyperlink
 * opacity				number
 * path					string		SVG path string format
 * r					number		radius of the circle, ellipse or rounded corner on the rect
 * rx					number		horisontal radius of the ellipse
 * ry					number		vertical radius of the ellipse
 * src					string		image URL, only works for Element.image element
 * stroke				string		stroke	colour
 * stroke-dasharray		string 		[“”, “-”, “.”, “-.”, “-..”, “. ”, “- ”, “--”, “- .”, “--.”, “--..”]
 * stroke-linecap		string		[“butt”, “square”, “round”]
 * stroke-linejoin		string		[“bevel”, “round”, “miter”]
 * stroke-miterlimit	number
 * *stroke-opacity		number
 * stroke-width			number		stroke width in pixels, default is '1' targetstring used with href
 * text					string		contents of the text element. Use \n for multiline text 
 * text-anchor			string 		[“start”, “middle”, “end”], default is “middle”
 * title				string 		will create tooltip with a given text transformstring see Element.transform
 * width				number
 * x					number
 * y					number
 * 
 */

import java.io.Serializable;

import com.google.gson.JsonObject;

public class G2Object implements Serializable
{
	private static final long serialVersionUID = -4954781120830780980L;

	protected G2DrawAttr drawAttr = new G2DrawAttr();
	protected G2DrawAttr hoverAttr = new G2DrawAttr();
	protected G2DrawAttr selectAttr = new G2DrawAttr();
	
	protected String guid;	
	protected String xtype;
	
	public G2Object() {}
	
	public JsonObject toJSON(JsonObject  element) {
		JsonObject data = new JsonObject();
		data.addProperty("guid", this.getGuid());
		element.add("data", data);
		
		JsonObject attr = new JsonObject();
		attr.addProperty("type", this.getType());
		drawAttr.toJSON(attr);
		element.add("draw", attr);
		
		return element;
	}

	// ----- Getter and setter methods ---------------------------------------- 
	
	/**
	 * Vraci typ objektu 
	 * @return
	 */
	public String getType() {
		return xtype;
	}
	
	/**
	 * Nastavi typ objektu
	 */
	public G2Object setType(String type) {
		this.xtype = type;
		return this;
	}
	

	// -----  -----------------------------------------------------------------
	
	/**
	 * Vraci GUID objektu
	 * @return
	 */
	public String getGuid() {
		return guid;
	}
	
	/**
	 * Nastavi GUID objektu
	 * @param guid
	 */
	public void setGuid(String guid) {
		this.guid = guid;
	}

	public G2DrawAttr getDrawAttr() {
		return drawAttr;
	}

	public void setDrawAttr(G2DrawAttr drawAttr) {
		this.drawAttr = drawAttr;
	}

	public G2DrawAttr getHoverAttr() {
		return hoverAttr;
	}

	public void setHoverAttr(G2DrawAttr hoverAttr) {
		this.hoverAttr = hoverAttr;
	}

	public G2DrawAttr getSelectAttr() {
		return selectAttr;
	}

	public void setSelectAttr(G2DrawAttr selectAttr) {
		this.selectAttr = selectAttr;
	}
	
}
